using BasicsClassLibrary.Tool.Configure;
using BasicsClassLibrary.Tool.ConsulSet;
using BasicsClassLibrary.Tool.Kong;
using WebApplication2;
IConfiguration configuration = new ConfigurationBuilder()
                            .AddJsonFile("appsettings.json")
                            .Build();
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton(new AppHelper(configuration));

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.RouteRegistToKong();
var app = builder.Build();
app.Urls.Add("http://*:5001");
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseAuthorization();
app.Configuration.RegToConsul();
app.MapControllers();

app.Run();
